/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejemploxml;

import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/**
 *
 * @author lynx
 */
public class AccesoXML {
    
    private final String nombre;
    private DocumentBuilderFactory docFactory;
    private DocumentBuilder docBuilder;
    private Document doc;
    private NodeList nodos;

    public AccesoXML(String nombre) throws ParserConfigurationException, SAXException, IOException {
        this.nombre = nombre;
        docFactory = DocumentBuilderFactory.newInstance();
        docBuilder = docFactory.newDocumentBuilder();
        doc = docBuilder.parse(nombre);
        nodos = doc.getFirstChild().getChildNodes();
    }

    NodeList obtenNodos() {
        return nodos;
    }
    
}
